{* Smarty *}
{extends file="include/base_with_menu.tpl"}

{block name="external_javascript"}
<script type="text/javascript" src="/scripts/jquery-ui/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="/scripts/oa_calendar.js"></script>
{literal}
<style>
.icon {display:none}
#msgText {margin-top:10px}
</style>
{/literal}
{/block}

{block name="javascript"}
<script type="text/javascript">
function show_school_pancel()
{
	$('h2').text('选择项目学校');
	Popup.alertMsg($('#choose_school_pancel').html(), show_school_list);
}
function show_school_list()
{
	var html = '';
	$('#choose_school_pancel input:checked').each(function(){
		html += $(this.parentNode).text() + '&nbsp;&nbsp;';
	});
	$('#school_list').html(html);
}
function show_member_pancel()
{
	$('h2').text('选择项目成员');
	Popup.alertMsg($('#choose_member_pancel').html(), show_member_list);
}
function show_member_list()
{
	var html = '';
	$('#choose_member_pancel input:checked').each(function(){
		html += $(this.parentNode).text() + '&nbsp;&nbsp;';
	});
	$('#member_list').html(html);
}
$(function() {
	$('.calender').datepicker();
	
});
</script>
{/block}

{block name="content"}
<h3 class="blockTitle">添加项目</h3>
<div class="layout">
    <form method="post" action="/market/se/project/add" enctype="multipart/form-data">
    <table width="100%" class="tbLayout01" cellspacing="0" cellpadding="0">
        <tr>
            <td width="100" class="textRight">*项目起始时间：</td>
            <td class="textLeft">
                <input type="text" class="txt01 calender" name="start_time" />
            </td>
        </tr>
        <tr>
            <td class="textRight">*项目结束时间：</td>
            <td class="textLeft">
                <input type="text" class="txt01 calender" name="end_time" />
            </td>
        </tr>
        <tr>
            <td class="textRight">*项目名称：</td>
            <td class="textLeft">
                <input type="text" class="txt01" name="name" maxlength="10" />
            </td>
        </tr>
        <tr>
            <td class="textRight">选择项目成员：</td>
            <td class="textLeft">
                <input type="button" id="choose_member" value="选择成员" onclick="show_member_pancel()" />
                <span id="member_list"></span>
            </td>
        </tr>
        <tr>
            <td class="textRight">选择项目学校：</td>
            <td class="textLeft">
                <input type="button" value="选择学校" onclick="show_school_pancel();" />
                <span id="school_list"></span>
            </td>
        </tr>
        <tr>
            <td class="textRight">上传DM单附件：</td>
            <td class="textLeft">
                <input type="file" name="attachment" />
            </td>
        </tr>
        
        <tr>
            <td class="textRight">&nbsp;</td>
            <td class="textLeft">
                <input type="submit" value="提 交" />&nbsp;&nbsp;
                <input type="button" value="取 消" onclick="window.history.back();" />
            </td>
        </tr>
    </table>
    <input type="hidden" name="{$token_name|escape}" value="{$token_hash}" />
    <input type="hidden" name="return_url" value="{$return_url|default:''}" />
    
    <div id="choose_school_pancel" style="display:none">
    <table class="tbLayout01" width="100%" cellspacing="0" cellpadding="0">
    {foreach $schools as $area_id => $school_array}
    	<tr>
            <td width="60" class="textRight">[{$areas.$area_id.name|escape}]</td>
            <td class="textLeft">
   			{foreach $school_array as $school}
            	<label><input name="school[]" value="{$school.id}" type="checkbox" class="s{$school.id}" onclick="$('.s'+this.value).attr('checked', this.checked)" />{$school.name|escape}</label>&nbsp;&nbsp;
        	{/foreach}
            </td>
        </tr>
    {/foreach}
    	<tr>
    	</tr>
    </table>
    </div>
    
    <div id="choose_member_pancel" style="display:none">
    <table class="tbLayout01" width="100%" cellspacing="0" cellpadding="0">
    {foreach $members as $status => $status_member}
    	<tr>
            <td class="textLeft">[{$member_status_label.$status|escape}]</td>
        </tr>
        <tr>
            <td class="textLeft">
   			{foreach $status_member as $member}
            	<label><input name="member[]" value="{$member.id}" type="checkbox" class="m{$member.id}" onclick="$('.m'+this.value).attr('checked', this.checked)" />{$member.name|escape}</label>&nbsp;&nbsp;
        	{/foreach}
            </td>
        </tr>
    {/foreach}
    	<tr>
    	</tr>
    </table>
    </div>
    
    </form>

    <p>&nbsp;</p>
    <p class="cGreen">提示：</p>
    <ul class="textLeft tip">
        <li>点击取消返回项目列表页面，不会新增新项目</li>
    </ul>
</div>
{/block}
